<?php

class Application_Model_Feedback
{
    /**
     * @param int $id
     * @return bool
     */
    public static function confirmFeedback($id)
    {
        $dbAdapter = JDbAdapter::factory();

        try {
            $numberOfAffects = $dbAdapter->update(
                'FEEDBACKS', array('IsProcess' => true), "ID = $id"
            );
            if ($numberOfAffects == 0) {
                return false;
            }

            return true;
        } catch (Exception $ex) {
            JLog::log($ex->getMessage());
            return false;
        }
    }

    /**
     * @param int $id
     * @return bool
     */
    public static function unconfirmFeedback($id)
    {
        $dbAdapter = JDbAdapter::factory();

        try {
            $numberOfAffects = $dbAdapter->update(
                'FEEDBACKS', array('IsProcess' => false), "ID = $id"
            );
            if ($numberOfAffects == 0) {
                return false;
            }

            return true;
        } catch (Exception $ex) {
            JLog::log($ex->getMessage());
            return false;
        }
    }
}

